package san.entity.m;

import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.google.common.collect.Lists;
import com.orm.BaseEntity;

@Entity
@Table(name = "meal_supplier")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Supplier extends BaseEntity {

	/**
	 * 供应商
	 */
	private static final long serialVersionUID = 5173403689358677360L;
	private String name;
	private String address;
	private String telphone;
	private String introdution;
	@OneToMany(mappedBy = "supplier", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@OrderBy(value = "insertDate")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	private List<Product> products = Lists.newArrayList();//有序的关联对象集合

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getTelphone() {
		return telphone;
	}

	public void setTelphone(String telphone) {
		this.telphone = telphone;
	}

	public String getIntrodution() {
		return introdution;
	}

	public void setIntrodution(String introdution) {
		this.introdution = introdution;
	}

	public List<Product> getProducts() {
		return products;
	}

	public void setProducts(List<Product> products) {
		this.products = products;
	}

}
